/* 
 * File:   medialin.hpp
 * Author: spledger
 *
 * Created on January 3, 2009, 8:04 PM
 */

#ifndef _MEDIALIN_HPP
#define	_MEDIALIN_HPP
#include <iostream>
#include <list>
#include <sys/dir.h>
#include <sys/types.h>
#include <sys/param.h>
#include <boost/filesystem.hpp>
#include <magic.h>
#include <SDL/SDL.h>
#include <SDL/SDL_image.h>
#include <SDL_Pango.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <gst/gst.h>
#include <string>
using namespace std;
struct ML_2Dsize{
    int height;
    int width;
};
struct ML_3Dsize{
    int height;
    int width;
    int depth;
};

class ML_Provider {
public:
    string file;
    static string * handles[];
    ML_Provider();
    ML_Provider(string fileName);
    void parseFile();
    void handleClick(int x, int y);
    SDL_Surface * getImage();
    ML_2Dsize * getSize();
};
// now, include the known providers.
#include "ml_provider_video.hpp"


class ML_Item{
private:
    ML_Provider provider;
    string fileLocation;
    int type;
    int curState;
    ML_2Dsize size;
public:
    ML_Item(string filename);
    ML_Item(const ML_Item &copyin);
    ML_Provider * getProvider();
    SDL_Surface *get_image(float percent);
    ML_2Dsize *getSize();
    SDL_Surface *get_video();
    void doAction(int x,int y);
    ML_Item &operator=(const ML_Item &rhs);
    int operator==(const ML_Item &rhs) const;
    int operator<(const ML_Item &rhs) const;

};

class MediaLin{
private:
    char curDir[];
    int *screenInt[];
    list<ML_Item> curDirItems;
    int errInt;
    string errTxt;
    int count;
public:
    MediaLin();
    void doUpdate();
    static void setup_opengl(int width, int height);
    void readDirectories();
    void chDir(char pathname[]);
    int wasError(){return errInt;};
    string getError(){return this->errTxt;};
    void doAction(int x, int y);
    SDL_Surface * drawScreen(SDL_Surface * curScreen);
};



#define ML_Item_OtherType 0
#define ML_Item_ImageType 1
#define ML_Item_VideoType 2
#define ML_Item_AudioType 3
#define ML_Item_DirectoryType 4


#endif	/* _MEDIALIN_HPP */

